/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ro.futurefeed.view;

import java.io.Serializable;
import java.util.Date;
import ro.futurefeed.api.FeedStatus;
import ro.futurefeed.model.FacebookQLUser;
import ro.futurefeed.util.DateUtil;

/**
 *
 * @author Georgian
 */
public class FeedView implements Serializable, Cloneable{
    
    private Long id;
    private String fbId;
    private FeedStatus status = FeedStatus.WAITING;
    private Date date;
    private Byte timezone = 0;
    private String content;
    private boolean sendNotification = true;
    private boolean myWall = true;
    private FacebookQLUser friend = new FacebookQLUser();
    
    public String getContentTruncated(){
        if(getContent()!= null && getContent().length() >= 60){
            return getContent().substring(0, 57) + "...";
        }
        return getContent();
    }
    
    public String getTimezoneAsString(){
        String timeZoneString = "GMT";
        if(timezone == 0){
            return timeZoneString;
        }else{
            if(timezone > 0){
                return timeZoneString + "+" + timezone;
            }else{
                return timeZoneString + timezone;
            }
        }
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getDate() {
        return date;
    }
    
    public String getDateString() {
        return DateUtil.getDateAtString(date);
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getFbId() {
        return fbId;
    }

    public void setFbId(String fbId) {
        this.fbId = fbId;
    }

    public String getFriendId() {
        return friend.getUid();
    }

    public void setFriendId(String friendId) {
        friend.setUid(friendId);
    }

    public String getFriendName() {
        return friend.getName();
    }

    public void setFriendName(String friendName) {
        friend.setName(friendName);
    }

    public String getFriendPhotoURL() {
        return friend.getPic_square();
    }

    public void setFriendPhotoURL(String friendPhotoURL) {
        friend.setPic_square(friendPhotoURL);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public boolean isMyWall() {
        return myWall;
    }

    public void setMyWall(boolean myWall) {
        this.myWall = myWall;
    }

    public boolean isSendNotification() {
        return sendNotification;
    }

    public void setSendNotification(boolean sendNotification) {
        this.sendNotification = sendNotification;
    }

    public FeedStatus getStatus() {
        return status;
    }

    public void setStatus(FeedStatus status) {
        this.status = status;
    }

    public Byte getTimezone() {
        return timezone;
    }

    public void setTimezone(Byte timezone) {
        this.timezone = timezone;
    }

    public FacebookQLUser getFriend() {
        return friend;
    }

    public void setFriend(FacebookQLUser friend) {
        this.friend = friend;
    }
    
    @Override
    public FeedView clone() throws CloneNotSupportedException {
        return (FeedView) super.clone();
    }
}
